package com.snail.controller;

import com.snail.model.pojo.user.SysTag;
import com.snail.result.Result;
import com.snail.service.SysTagService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author 蔡徐坤
 * @Date 2025/8/16 14:47
 * @Description: TODO
 */
@RestController
@RequestMapping("/sysTag")
@RequiredArgsConstructor
public class SysTagController {


    private final SysTagService sysTagService;

    /**
     * 获取所有的标签
     */
    @GetMapping("/TagList")
    public Result<List<SysTag>> TagList() {
        return Result.success(sysTagService.list());
    }

    /**
     * 获取当前登录用户第一次选择的标签
     */
    @GetMapping("/firstTag")
    public Result<List<SysTag>> firstTag() {
        return sysTagService.getFirstTag();
    }

    /**
     * 插入用户第一次选择的标签
     */
    @PostMapping("/saveFirstTag")
    public Result saveFirstTag(@RequestBody List<Long> tagIds) {
        sysTagService.saveFirstTag(tagIds);
        return  Result.success("用户第一次选择标签成功");
    }
}
